﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using BUS;
using Public;

namespace QuanLyKhoHangVatTu
{
    public partial class ChiTietXuatKho : DevExpress.XtraEditors.XtraForm
    {
        XuatKho_BUS xk_bus = new XuatKho_BUS();
        XuatKho_PB xk_pb = new XuatKho_PB();
        Flag_PB flag_pb = new Flag_PB();

        public ChiTietXuatKho()
        {
            InitializeComponent();
        }

        private void ChiTietXuatKho_Load(object sender, EventArgs e)
        {
            Flag_PB.Flag = 7;
            gridXuatKho.DataSource = xk_bus.LayDSPhieuXuat();
        }

        private void gridControl2_Click(object sender, EventArgs e)
        {
            
        }

        private void xtraTabControl2_Click(object sender, EventArgs e)
        {

        }

        private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            string ma = XuatKho_PB.MaPX = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MAPX").ToString();
            gridChiTiet.DataSource = xk_bus.TimMaPhieuXuat(ma);
            XuatKho_PB.MaPX = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MAPX").ToString();
            XuatKho_PB.MaKH = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MAKH").ToString();
            XuatKho_PB.TenKH= gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TENKH").ToString();
            XuatKho_PB.NguoiNhan = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGUOINHAN").ToString();
            XuatKho_PB.DiaChi = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DIACHI").ToString();
            XuatKho_PB.LyDoXuat = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "LYDOXUAT").ToString();
            XuatKho_PB.NhanVien = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NHANVIEN").ToString();
            XuatKho_PB.NgayHachToan = Convert.ToDateTime(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGAYHACHTOAN").ToString());
            XuatKho_PB.NgayChungTu = Convert.ToDateTime(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGAYCHUNGTU").ToString());
        }
    }
}